package com.hp.provider.dubbo;


import com.alibaba.fastjson.JSON;
import com.alibaba.nacos.common.utils.UuidUtils;
import com.hp.common.api.UserService;
import com.hp.common.common.Result;
import com.hp.common.entity.UpdateUserParam;
import com.hp.common.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author dongxing
 * @since 2019-05-19
 */
@DubboService
@Slf4j
public class UserServiceImpl implements UserService {

    @Override
    public User findUserByName(String name) {
        final User user = User.builder().name(name).age(UuidUtils.generateUuid().hashCode()).build();
        log.info("receive request info. info=[{}]", JSON.toJSONString(user));
        return user;
    }

    @Override
    public Result<UpdateUserParam> updateUser(UpdateUserParam param) {
        log.info("receive request info. info=[{}]", JSON.toJSONString(param));
        return Result.createBySuccess(param);
    }
}
